package zuoye04;

public class RightTriangle extends Shape {
    int base;
    int height;

    public RightTriangle(int base, int height) {
        this.base = base;
        this.height = height;
    }

    public int getBase() {
        return base;
    }

    public void setBase(int base) {
        if (base >= 1 & base <= 20) {
            this.base = base;
        } else {
            System.out.println("错误");
        }
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        if (height >= 1 & height <= 20) {
            this.height = height;
        } else {
            System.out.println("错误");
        }
    }

    @Override
    public void draw() {
        for (int i = 0; i < height; i++) {
            for (int k = 0; k < 2*i; k++) {
                System.out.print("*");
            }
            System.out.println("*");
        }
    }

    public static void main(String[] args) {
        RightTriangle a = new RightTriangle(8, 4);
        a.draw();
    }
}
